<% /* $Id: contestusers.jsp 132 2011-08-26 10:23:42Z altdotua@gmail.com $ */ %>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ include file="../header.jsp" %>

<h2 align="center">Contest Users</h2>

<%= DJudgeUtils.generateTable(request, response, ContestUserEntry.class, ContestUsersModel.getCore()) %>

<%
	ContestUserEntry entry = ContestUsersModel.getEntry(Long.parseLong(request.getParameter("id")));
%>
<h2><%= entry == null ? "Add contest user" : "Edit contest user\"" + entry + "\"" %></h2>

<form action="<%= Linker.link("contestusers") %>" method="post">
	<input type="hidden" name="action" value="edit">
  <p><input type="hidden" name="id" value="<%= null == entry ? "" : entry.getId() %>"></p>
  <p>Contest<select name="contestId">
<%
	List<ContestEntry> contests = ContestsModel.getAllEntries();
	String contestId = null != entry ? entry.getContestId().toString() : "";
	for (ContestEntry contest2 : contests)
	{
%>
		<option value="<%=contest2.getId()%>" <%= contest2.getId().toString().equals(contestId) ? " selected=\"selected\"" : "" %>><%=contest2%> 
<%
 	}
%>
	</select></p>  
  <p>User<select name="userId">
<%
	List<UserEntry> users = UsersModel.getAllEntries();
	String userId = null != entry ? entry.getUserId().toString() : "";
	for (UserEntry language : users)
	{
%>
		<option value="<%= language.getId() %>" <%= language.getId().toString().equals(userId) ? " selected=\"selected\"" : "" %>><%= language %> 
<%
 	}
%>
	</select></p>  
  <p><input type="checkbox" name="active" <%= null == entry || entry.getActive() ? "checked='checked'" : "" %>>Active?</p>
  <p><input type="submit" value="Submit"></p>
</form>


<%@ include file="../footer.jsp" %>
